from flask import Flask, abort, jsonify
app = Flask(__name__)
@app.errorhandler(404)
def resource_not_found(e):
    return jsonify(error=str(e)), 404

@app.route('/cheese')
def get():
    resource = None
    if resource is None:
        abort(404, description='r not found')
    return jsonify(resource)

if __name__ == "__main__":
    app.run()